#ifndef EFFECT_H__
#define EFFECT_H__

#include <vector>
#include <fstream>
#include <functional>

using std::vector;
using std::istream;

typedef int EffectType;
const EffectType EffectWeapon = 0;
const EffectType EffectMagic = 1;

typedef int EffectTargetSide;
const EffectTargetSide SELF = 1 << 0;
const EffectTargetSide ALLY = 1 << 1;
const EffectTargetSide ENEMY = 1 << 2;

typedef int EffectTargetType;
const EffectTargetType EffectTargetCharacter = 0;
const EffectTargetType EffectTargetBlock = 1;
const EffectTargetType EffectTargetGlobal = 2;

struct EffectSingle {
	bool visible;
	EffectType type;
	EffectTargetType targetType;
	EffectTargetSide targetSide;

	int delay, duration;

	int hp, mp, hpMax, mpMax;
	int attack, defence, range;

	EffectSingle(istream&);
};

typedef vector<EffectSingle> Effect;

class Spell {
public:
	Spell();

private:
	Effect _effect;
	int _actionPoint;
public:
	const Effect& effect;
	const int& actionPoint;

	//name;
public:
	Spell(Effect& effects, int actionPoint) :
		_effect(effects), _actionPoint(actionPoint),
		effect(_effect), actionPoint(_actionPoint) { //TODO need std::move?

	}
};

class Character;
struct EffectOnCharacter {
	int delay, duration;
	const Character& caster;
	const EffectSingle& effect;

	EffectOnCharacter(const Character& caster, const EffectSingle& effect)
		: caster(caster), effect(effect), delay(effect.delay), duration(effect.duration) {}
};

typedef vector<vector<Spell*>> SpellSet;

#endif //EFFECT_H__